function start(){
	trendLoader();
	prepareServices(1);
	sourceLoader();
}

function sourceLoader(){

	try{
	
		var source=new Object();
		source.name="Globo.com";
		source.url="http://www.globo.com";
		source.url="http://www.globo.com";
		source.language="pt";
		sources[sources.length]=source;
		
		
		/*
		source=new Object();
		source.name="Folha";
		source.url="http://www.folha.com.br";
		source.language="pt";
		sources[sources.length]=source;

		source=new Object();
		source.name="Zero Hora";
		source.url="http://www.zerohora.com.br";
		source.language="pt";
		sources[sources.length]=source;
		
		source=new Object();
		source.name="Estadao";
		source.url="http://www.estadao.com.br";
		source.language="pt";
		sources[sources.length]=source;
*/
	}catch(e){
		error("sourceLoader"+e.description);
	}
}



function trendLoader(){

	try{
		
		//from consumer
		getTrends(1);
		
		var html="";
		
		for(var i=0;i<trends.length;i++){
			var trend=trends[i];
			html+="<p class='trend' onclick=addFilterSocial('"+trend.name+"')>"+unescape(trend.name)+"</p>";	
		}
		
		var social = $("#socialwords");
			
		social.html(html);

	}catch(e){
		error("trendLoader"+e.description);
	}
}

//THIS IS A FUCKING MOCK
function prepareServices(local){

	try{
	
	
	try{
	
		services=new Array();
	
	//alert(1);
		var service = new Object();
		service.name="Facebook";
		service.url="http://www.facebook.com";
		service.description="The largest social network";
		
		services[services.length]=service;
		
	//alert(2);
		service = new Object();
		service.name=escape("Hostel World");
		service.url= "http://www.hostelworld.com/";
		service.description="The most used hostel";
		
		services[services.length]=service;
		
		service = new Object();
		service.name=escape("Ebay");
		service.url= "http://www.ebay.com/";
		service.description="Sell or buy anything";
		
		services[services.length]=service;
		
		service = new Object();
		service.name=escape("Amazon");
		service.url= "http://www.amazon.com/";
		service.description="Buy books";
		
		services[services.length]=service;
		
	}catch(e){
		error("searchServices"+e.description);
	}
	
	}catch(e){
		error("prepareServices"+e.description);
	}
}
